<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%--
  Created by IntelliJ IDEA.
  User: 董灌磊
  Date: 2024/4/11
  Time: 21:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="/webjars/layui/2.6.8/css/layui.css">
    <script src="/webjars/layui/2.6.8/layui.js"></script>
</head>
<body>
<div class="layui-form" id="searchForm" lay-filter="searchForm">
    <div class="layui-inline">
        <label class="layui-form-label">业主姓名:</label>
        <div class="layui-input-inline">
            <input type="text" name="ownername" placeholder="输入业主姓名" class="layui-input">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">业主手机号:</label>
        <div class="layui-input-inline">
            <input type="text" name="ownerphone" placeholder="输入业主手机号" class="layui-input">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">车位编号:</label>
        <div class="layui-input-inline">
            <input type="text" name="parkinglotname" placeholder="输入车位编号" class="layui-input">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">停车场名称:</label>
        <div class="layui-input-inline">
            <input type="text" name="parkname" placeholder="输入停车场名称" class="layui-input">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">停车场名称:</label>
        <div class="layui-input-block">
            <select name="isno" id="isno">
                <option value="-1">请选择</option>
                <option value="0">未缴费</option>
                <option value="1">已缴费</option>
            </select>
        </div>
    </div>
    <div class="layui-inline">
        <button class="layui-btn" onclick="search()" >查询</button>
    </div>
    <div class="layui-inline">
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
</div>


<table id="paymentTable" lay-filter="paymentTables"  class="layui-table layui-table-hover"></table>
<script>
    layui.use(function (){
        let table=layui.table;
        table.render({
            id:"one",
            elem:"#paymentTable",
            url:"/park/payment/show",
            toolbar: "#headTool",
            page:true,
            cols:[[
                {field:'number',align: 'center',type:'numbers',title:"编号"},
                {field:'id',align: 'center',hide:true,title:"序号"},
                {field:'ownername',align: 'center',title:"业主姓名"},
                {field:'ownerphone',align: 'center',title:"业主手机号"},
                {field:'parklotname',align: 'center',title:"车位编号"},
                {field:'parkname',align: 'center',title:"停车场名"},
                {field:'starttime',align: 'center',title:"开始时间"},
                {field:'endtime',align: 'center',title:"结束时间"},
                {field:'money',align: 'center',title:"收费规则",templet(r){
                    return r.money+"日/月"
                    }},
                {field:'zomoney',align: 'center',title:"本次费用",templet(r) {
                        return r.zomoney+"元";
                    }},
                /*{field:'',align: 'center',title:"是否缴费",templet(r) {
                        return r.isno==0?"未缴费":"已缴费";
                    }},*/
                {field:'',align: 'center',title:"崔缴费",templet(r) {
                        if(r.isno==0){
                            return "<a lay-event='stopcarmoney' style='color: red'>未缴费</a>"
                        }else {
                            return '已缴费'
                        }
                    }},
            ]]
        })
    })
    //点击去查询
    function search(){
        //获取表单的值,表单序列化
        var where = layui.form.val('searchForm');
        console.log(where)
        //条件查询，重载表格因为键和值都是where，所以可以值保留键
        layui.table.reload('one',{
            page: {
                curr:1
            },
            where:where
        });
    }
</script>
</body>
</html>
